home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7790 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: erich.triumf.ca!bennett
  2. From: bennett@erich.triumf.ca (P.Bennett)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: sin function in Turbo C 3
  5. Date: 28 Feb 1996 15:20 PST
  6. Organization: TRIUMF: Tri-University Meson Facility
  7. Distribution: world
  8. Message-ID: <28FEB199615204861@erich.triumf.ca>
  9. References: <4h2al3$rim@mulgave.octacon.co.uk>
  10. NNTP-Posting-Host: ftp.triumf.ca
  11. News-Software: VAX/VMS VNEWS 1.50    
  12.  
  13. In article <4h2al3$rim@mulgave.octacon.co.uk>, Nik.Palmer@onyx.octacon.co.uk (Nik Palmer) writes...
  14. >Hi easy  question first,
  15. >when findng the angle in trigonometry on my calc I use the sin-1
  16. >function to give me the answer in degrees  a la
  17. >sin(theta)=opp/hyp
  18. >but Turbo C only has the sin function how do I get the answer in
  19. >degrees(or radians)
  20.  
  21. Look at asin() and acos()
  22.  
  23. >Q2
  24. >when dividing doubles using the / function I would like to have the
  25. >answer in the form 10/3 = 3.3333etc  like I know I lose the fraction,
  26. >I can get around this using the other functions which provide me with
  27. >the remiander to redivide, or multiply the number to be divided by
  28. >1000 then do some bits to get the result.
  29.  
  30. division with doubles using "/" should give a decimal result.
  31.  
  32. However, "10/3" will be done with ints because constants with no decimal
  33. places _are_ ints (therefore, no fraction on the result).  To force the 
  34. division to be done with floats or doubles, make your constants floats, 
  35. like: 10.0/3.0
  36.  
  37. Peter Bennett VE7CEI                | Vessels shall be deemed to be in sight
  38. Internet: bennett@triumf.ca         | of one another only when one can be
  39. Packet: ve7cei@ve7kit.#vanc.bc.ca   | observed visually from the other
  40. TRIUMF, Vancouver, B.C., Canada     |                          ColRegs 3(k)
  41. GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.